import 'package:flutter/material.dart';
import 'package:gzmall_app/common/color_common.dart';
import 'mine_coupon_list_item_widget.dart';

class CouponPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return new CouponPageState();
  }
}

class CouponPageState extends State<CouponPage> {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: _createAppBar(),
      body: new DefaultTabController(
        length: 3,
        child: new Container(
          color: Colors.white,
          child: new Column(children: <Widget>[
            new Container(
              height: 48.0,
              margin: const EdgeInsets.only(left: 30.0, right: 30.0),
              child: new TabBar(
                labelColor: ColorCommon.primaryColor,
                unselectedLabelColor: ColorCommon.grey6,
                tabs: <Widget>[
                  new Tab(text: "未使用"),
                  new Tab(text: "已使用"),
                  new Tab(text: "已过期"),
                ],
              ),
            ),
            new Expanded(
              child: new TabBarView(
                children: <Widget>[
                  MineCouponListItemWidget("unused"),
                  MineCouponListItemWidget("used"),
                  MineCouponListItemWidget("overdue"),
                ],
              ),
            ),
          ]),
        ),
      ),
    );
  }

  _createAppBar() {
    return new AppBar(
      elevation: 0.0,
      title: new Text("我的优惠券"),
      leading: new IconButton(
        icon: new Icon(Icons.arrow_back_ios),
        onPressed: () {
          Navigator.of(context).pop();
        },
      ),
      actions: <Widget>[
        new Container(
          child: Text("使用优惠券说明"),
          alignment: Alignment.center,
          padding: EdgeInsets.only(right: 15.0),
        ),
      ],
    );
  }
}
